-- mine_keep
-- created by panyl
-- 守护矿山

return {
    apply = function(prop, baseValue)
        return prop[3];
    end,

    record = function(target, prop, path)
        return false;
    end,

    -- 采矿触发
    trigger = function(who, prop, mineId)
        -- 一定是要怪物
        if who.type ~= OBJECT_TYPE_MONSTER then
            return false;
        end

        local targetId = tonumber(prop[3]);
        if targetId > 0 and targetId ~= mineId then
            return false;
        end

        local skillId = tonumber(prop[2]);

        local arr = PropM.combine(ME.user, "stop_action", 1);
        if PropM.apply(arr, 1) > 0 then
            return false;
        end

        -- 怪物攻击玩家
        SkillM.apply(who, ME.user, skillId, CombatM.getRound());

        SkillM.getSequence(ME.user):start(who, ME.user, 0);

        return true;
    end,
};
